package com.station.server.entity;

import com.station.client.proxies.PCoordinates;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * User: JinJavaMojo
 * Date: 25.09.13
 */

@Embeddable
public class Coordinates {

    public Coordinates() {
    }

    public Coordinates(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Column(name = "X")
    public int x;

    @Column(name = "Y")
    public int y;

    public static Coordinates transform(PCoordinates pCoordinates) {
        if (pCoordinates != null)
            return new Coordinates(pCoordinates.x,pCoordinates.y);
        else
            return new Coordinates();
    }

}
